/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Database;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "INSURANCE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Insurance.findAll", query = "SELECT i FROM Insurance i"),
    @NamedQuery(name = "Insurance.findByInsurancetype", query = "SELECT i FROM Insurance i WHERE i.insurancetype = :insurancetype"),
    @NamedQuery(name = "Insurance.findByName", query = "SELECT i FROM Insurance i WHERE i.name = :name"),
    @NamedQuery(name = "Insurance.findByDuration", query = "SELECT i FROM Insurance i WHERE i.duration = :duration"),
    @NamedQuery(name = "Insurance.findByFee", query = "SELECT i FROM Insurance i WHERE i.fee = :fee"),
    @NamedQuery(name = "Insurance.findByDescription", query = "SELECT i FROM Insurance i WHERE i.description = :description")})
public class Insurance implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "INSURANCETYPE")
    private Integer insurancetype;
    @Size(max = 30)
    @Column(name = "NAME")
    private String name;
    @Column(name = "DURATION")
    @Temporal(TemporalType.DATE)
    private Date duration;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "FEE")
    private Double fee;
    @Size(max = 40)
    @Column(name = "DESCRIPTION")
    private String description;

    public Insurance() {
    }

    public Insurance(Integer insurancetype) {
        this.insurancetype = insurancetype;
    }

    public Integer getInsurancetype() {
        return insurancetype;
    }

    public void setInsurancetype(Integer insurancetype) {
        this.insurancetype = insurancetype;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getDuration() {
        return duration;
    }

    public void setDuration(Date duration) {
        this.duration = duration;
    }

    public Double getFee() {
        return fee;
    }

    public void setFee(Double fee) {
        this.fee = fee;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (insurancetype != null ? insurancetype.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Insurance)) {
            return false;
        }
        Insurance other = (Insurance) object;
        if ((this.insurancetype == null && other.insurancetype != null) || (this.insurancetype != null && !this.insurancetype.equals(other.insurancetype))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Database.Insurance[ insurancetype=" + insurancetype + " ]";
    }
    
}
